package com.mxpio.erp.common.workshop.entity;

import com.mxpio.erp.common.technology.entity.WorkShop;
import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.security.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
@Entity
@Table(name = "v_mb_erp_workshop_passrate_detail")
@Schema(description="各车间生产质量情况")//根据质检单的检验结果按月汇总统计
public class VWorkShopPassRateDetail implements DictAble, Serializable {
	
	private static final long serialVersionUID = 1L;
	
	@Transient
	private Map<String, String> textMap;

	public String putText(String key, String value) {
		if (textMap == null) {
			textMap = new HashMap<>();
		}
		return textMap.put(key, value);
	}
	@Id
	@Column(name = "BIZ_NO_")
	@Schema(description = "业务单号")
	private String bizNo;

	@Column(name = "YEARMON")
	@Schema(description = "年份")
	private String yearmon;

	@Column(name = "year_")
	@Schema(description = "年份")
	private String year;

	@Column(name = "mon_")
	@Schema(description = "月份")
	private String mon;

	@Column(name = "TEST_RESULT_")
	@Schema(description = " 检验结论")
	@Dict(dicCode = "MB_QUALITY_CHECK_RESULT")//0不合格，1合格
	private String testResult;

	@Column(name = "WORK_SHOP_CODE_")
	@Schema(description = "所属车间")
	@Dict(dicCode="workShopCode",dicEntity= WorkShop.class,dicText="workShopName")
	private String workShopCode;

	@Column(name = "WORK_SHOP_TYPE_")
	@Schema(description = "车间类型")
	@Dict(dicCode = "ERP_TECH_WORK_SHOP_TYPE")
	private String workShopType;

	@Column(name = "cnt_")
	@Schema(description = "质检单数量")
	private BigDecimal cnt;

	@Column(name = "pass_cnt_")
	@Schema(description = "合格数量")
	private BigDecimal passCnt;

	@Transient
	@Schema(description = "合格率(%)")
	private BigDecimal passRate;
}
